﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

namespace CommonLib
{
	public abstract class UIElementBase : MonoBehaviour
	{
		public string ElementName { get { return m_Name; } }
		protected string m_Name;
		protected UnityEvent m_ActionEvent = null;

		public virtual void ElementInit(string _name)
		{
			m_Name = _name;
			GetProperties();
		}
		public virtual void Excute()
		{
			m_ActionEvent.Invoke();
		}
		public virtual void AddListener(UnityAction _actionEvent)
		{
			if (null != _actionEvent)
				m_ActionEvent.AddListener(_actionEvent);
		}

		protected abstract void GetProperties();
	}
}